package com.alan.ssh.dao.impl;

import com.alan.ssh.dao.ProductDao;
import com.alan.ssh.model.Product;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate4.HibernateTemplate;
import org.springframework.stereotype.Repository;

/**
 * @author Alan
 * @Description
 * @date 2020年11月30日 21:39
 */
@Repository

public class ProductDaoImpl implements ProductDao {


    private HibernateTemplate template;
    @Autowired
    public ProductDaoImpl(SessionFactory sessionFactory) {
        this.template = new HibernateTemplate(sessionFactory);
    }

    @Override
    public void saveProduct(Product product) {
        template.save(product);
    }
}
